insert overwrite table jms_dm.dm_lmdm_four_segment_push_cainiao_hi partition (dt)
select
      substr(t.dt, 1, 10)  as date_time                           --分区
     ,t2.name  as network_name                                     --网点名称
     ,t1.network_code                                              --网点名称code	
     ,t1.courier_station_name                                      --驿站名称	
     ,t1.courier_station_code                                      --驿站id	
     ,t1.third_code                                                --3段码
     ,t.next_station_code                                          --4段码
     ,count(distinct t.waybill_no) as   bill_num                   --值
     ,from_unixtime(unix_timestamp(t.dt,'yyyy-MM-dd-HH') ,'yyyy-MM-dd HH:00:00')  as input_time     --分区	   
     ,t.dt  as dt             --分区
from jms_dwd.dwd_tab_barscan_collect_base_hi t 
left join jms_dim.dim_yl_lmdm_agent_point t1 on t.next_station=t1.unique_identify
left join jms_dim.dim_network_whole_massage t2 on t1.network_code=t2.code
where  t.dt >='{{ execution_date  | cst_ds }}-00' and t.dt<='{{ execution_date  | cst_ds }}-23'
       and t.next_station_code is not null
       and t.next_station is not null
       and t1.network_code is not null
       and t1.input_type=94
       and t.scan_type = '入库扫描'

group by 
      t2.name  
     ,t1.network_code
     ,t1.courier_station_name  --驿站名称	
     ,t1.courier_station_code  --驿站id	
     ,t1.third_code            --三段码码值	
     ,t.next_station_code      --4段码码值	
     ,t.dt
distribute by dt, abs(hash(network_code)) % 10
     
;